View Javadoc
1 package jrre.instructionset.math; 2 3 import jrre.*; 4 import jrre.types.*; 5 6 public class IInc extends jrre.instructionset.Instruction { 7 8 int operandOne; 9 int operandTwo; 10 11 public IInc(int operandOne, int operandTwo){ 12 13 this.operandOne = operandOne; 14 this.operandTwo = operandTwo; 15 16 name = "iinc"; 17 description = "foo foo moo poo"; 18 length = 2; 19 } 20 21 /*** 22 * Executes the <strong><code>iinc</code></strong> instruction. 23 * 24 */ 25 public void execute(){ 26 27 if(operandTwo > 128) 28 operandTwo = (256 - operandTwo) * -1; 29 30 PrimitiveType toIncrement = (PrimitiveType)Stack.getLocalVariable(operandOne); 31 int incrementedValue = toIncrement.getValue() + operandTwo; 32 33 //System.out.println("IInc:\told value: "+toIncrement.getValue()+" new value: "+incrementedValue); 34 //System.out.println("operand one: "+operandOne+" operand two: "+operandTwo); 35 36 Stack.setLocalVariable(operandOne, new PrimitiveType(incrementedValue)); 37 38 } 39 40 public String toString(){ 41 return "iinc"; 42 } 43 }

This page was automatically generated by Maven